<?php
var_dump($_GET);
$StudentId = $_GET['StudentId'] ??'';

// 连接数据库
$dsn = "sqlsrv:Server=LAPTOP-G184I03M\SQLEXPRESS;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql = "delete from Student where StudentId='{$StudentId}'";
$result = $db->exec($sql);
//var_dump($db->errorInfo()); // 排查数据库错误。
if ($result) {
    echo '删除成功';
} else{
    echo '删除失败';
}


